#ifndef MESSAGE_H
#define MESSAGE_H

#include <stddef.h>
#include <stdbool.h>

#define MAX_KEY_LENGTH 50
#define MAX_VALUE_LENGTH 50
#define MQTT_SUB "/emqx/mqtt/Limo_s"
#define MQTT_MSG_MAX_LENGTH 256

// 定义键值对结构体
typedef struct
{
    char key[MAX_KEY_LENGTH];
    char value[MAX_VALUE_LENGTH];
} MessageKeyValue;

// 初始化键值对
void msg_init(MessageKeyValue *pair, const char *key, const char *value);

// 生成要发送的消息
bool msg_generate(MessageKeyValue *pair, char *message, size_t message_size);

// 解析MQTT消息字符串
bool parse_mqtt_message(const char *message, MessageKeyValue *kvp);

#endif

